package com.jackrain.nea.ext.permission;

import lombok.Data;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @author lzm
 * @date 2017-11-22
 */
@Data
public class ActionPermissionModel extends MenuPermissionModel {
    private static final long serialVersionUID = 5135125324123220475L;
    private Long ad_action_id;
    private Collection<ActionPermissionModel> children;

    public static ActionPermissionModel union(ActionPermissionModel left, ActionPermissionModel right) {
        ActionPermissionModel result = new ActionPermissionModel();
        result.setId(-1L);      //复合型的model,没有id
        result.setGroupid(-1L); //复合型的model,没有groupId
        result.setAd_menu_id(left.getAd_menu_id());
        result.setName(left.getName());
        result.setDescription(left.getDescription());
        result.setAd_table_id(left.getAd_table_id());
        result.setAd_action_id(left.getAd_action_id());
        result.setMask(TableMaskHelper.union(left.getMask(), right.getMask()));
        result.setPermission(left.getPermission() | right.getPermission());
        return result;
    }
}
